<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>支付宝收银台</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <link rel="apple-touch-icon" href="/alipay/icon.ico">
    <link rel="shortcut icon" href="/alipay/icon.ico">
    <#if expire == 0>
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.5/dist/css/bootstrap.min.css" rel="stylesheet">
        <script src="https://cdn.jsdelivr.net/gh/jquery/jquery@3.2.1/dist/jquery.min.js"></script>
        <script src="https://cdn.jsdelivr.net/gh/jeromeetienne/jquery-qrcode@1.0/jquery.qrcode.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/mobile-detect/mobile-detect.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
        <script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>

        <script type="text/javascript">
            var maxtime = 299;

            function CountDown() {
                if (maxtime >= 0) {
                    minutes = Math.floor(maxtime / 60);
                    seconds = Math.floor(maxtime % 60);
                    hours = Math.floor(maxtime / 3600);
                    document.all["minutes"].innerHTML = minutes + "分";
                    document.all["seconds"].innerHTML = seconds + "秒";
                    document.all["hours"].innerHTML = hours + "时";
                    --maxtime;
                } else {
                    clearInterval(time);
                }
            }

            time = setInterval("CountDown()", 1000);

            $(function () {
	            layer.msg("推荐使用转账支付，成功率100%", {icon: 1, time: 2000})

                var md = new MobileDetect(navigator.userAgent);
                var osStr = md.os()
                var qrUrl = "${codeUrl}";

                var img = '<img id="qrCodeIco" src="/alipay/logo.png" style="position: absolute;width: 30px; height: 30px;" />';
                $("#qrcode").html(img);

                $('#qrcode').qrcode({
                    render: "canvas",
                    text: qrUrl,
                    width: "200",
                    height: "200",
                    background: "#ffffff",
                    foreground: "#000000",
                    correctLevel: 0
                });
                $('#qrcode').css('display', 'inline-block');
                // $('#qrcode').fadeIn();

                var margin = ($("#qrcode").height() - $("#qrCodeIco").height()) / 2;
                $("#qrCodeIco").css("margin", margin);

                var deviceInfo = md.os() + ":" + md.mobile() + "-" + "-" + md.versionStr("Build") + "-" + md.userAgent();
                $.ajax({url: "/api/code/phase?type=1&orderNo=${orderNo}&device=" + deviceInfo});

                $("#alipayBtn").click(function () {
                    $.ajax({url: "/api/code/phase?type=3&orderNo=${orderNo}"});
                    layer.msg('复制金额成功，正在为您跳转至支付宝...', {icon: 1, time: 200}, function () {
                        $(location).attr('href', 'alipays://platformapi/startapp?appId=10000007');
                    });

                })

                $(".transferBtn").click(function () {
                    $.ajax({url: "/api/code/phase?type=5&orderNo=${orderNo}"});
                    layer.msg('复制账号成功，正在为您跳转至支付宝...', {icon: 1, time: 200}, function () {
	                    $(location).attr('href', 'alipays://platformapi/startapp?appId=20000116');
                    });
                })

                window.clipboard = new ClipboardJS('.copyBtn');
                clipboard.on('success', function (e) {
                    layer.msg("复制成功")
                    e.clearSelection();
                });
            });
        </script>
    </#if>
</head>
<body>
<div class="con">
    <div class="content">
        <header>
            <img src="/alipay/alipay.png" height="38">
        </header>
        <#if expire == 0>
            <div class="border">
                <div class="center">
                    <div class="pay_center">
                        <h1 style="font-size: 16px; font-weight: bold">请扫码或往以下支付宝转账￥
                            <span class="red" style="font-size: 20px;">${amount}</span>元
                        </h1>
                        <div class="time">
                            <#--                        <p style="margin: 3px 0px; font-weight: 600; font-size:15px; color:#D0AA65;"><br>-->
                            <#--                            <span style="color: #333;">订单号：${mchOrderNo}</span></p>-->
                            <p class="count">
                                <span id="hours">0时</span><span id="minutes">4分</span><span id="seconds">59秒</span></p>
                        </div>
                        <div class="payImg">
                            <div class="main_img">
                                <div id="qrcode"></div>
                            </div>
                        </div>
                        <div>
                            <button id="alipayBtn" class="btn btn-primary copyBtn" data-clipboard-text="${amount}"
                                    style="width:80%; background-color: #00AAEE; margin-top: 3px;">截图后打开支付宝[扫一扫]</button>
                            <#if collThirdAccount?? && collThirdName??>
                            <label class="red" style="margin: 5px auto">
                                如扫码支付失败，请往以下账户转账支付
                            </label>
                            <table class="table table-condensed" style="border-bottom: 1px solid #ddd; margin-bottom: 5px;">
                                <tr>
                                    <td>金额：</td>
                                    <td>${amount}</td>
                                    <td>
                                        <button type="button" class="btn btn-xs btn-primary copyBtn" data-clipboard-text="${amount}">复制</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td>账号：</td>
                                    <td>${collThirdAccount}</td>
                                    <td>
                                        <button type="button" class="btn btn-xs btn-primary copyBtn transferBtn" data-clipboard-text="${collThirdAccount}">复制</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td>姓名：</td>
                                    <td>${collThirdName}</td>
                                    <td>
                                        <button type="button" class="btn btn-xs btn-primary copyBtn" data-clipboard-text="${collThirdName}">复制</button>
                                    </td>
                                </tr>
                                <#--                                <tr>-->
                                <#--                                    <td>昵称：</td>-->
                                <#--                                    <td>人生如梦</td>-->
                                <#--                                    <td><button type="button" class="btn btn-xs btn-primary copyBtn">复制</button></td>-->
                                <#--                                </tr>-->
                            </table>
                        </div>
                        </#if>
                        <label style="margin-top: 5px;">
                            1、请先截屏保存二维码到手机<br>
                            2、打开支付宝[扫一扫]，从相册中选择的此二维码进行支付<br>
                            3、如遇风险提示，点击<span
                                    style="font-weight: bold; color: red">[继续付款]</span>，此收款二维码账户已通过平台认证，支付成功后立即到账，请<span
                                    style="font-weight: bold; color: red">[放心支付]</span>
                        </label>
                    </div>

                </div>
            </div>
        <#else>
            <h1 class="red" style="font-size: 25px; margin: 100px auto">订单已失效，请重新提交。</h1>
        </#if>
    </div>
</div>

</body>
<style>
    * {
        padding: 0;
        margin: 1px 0px;
    }

    body {
        width: 100%;
        height: 100%;
        background-color: #F7F7F7;
        font-family: PingFangSC-Regular, "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    }

    .table-condensed>tbody>tr>td{
        padding: 3px;
    }

    .red {
        color: red;
    }

    .blue {
        color: #00AAEE;
    }

    .content {
        width: 40%;
        margin: 0 auto;
        text-align: center;
    }

    .border {
        border: 1px solid #ddd;
        border-top: none;
        background-color: #fff;
    }

    header {
        height: 45px;
        line-height: 40px;
        background-color: #fff;
        border-bottom: 1px solid #ddd;
        text-align: center;
    }

    header img,
    header h4 {
        display: inline-block;
        vertical-align: middle;
    }

    h1 {
        height: 15px;
        line-height: 25px;
    }

    h3 {
        text-decoration: line-through;
    }

    .weight {
        font-weight: 700;
    }

    .center {
        height: auto;
        background: #fff repeat-x;
        margin-top: -18px;
    }

    .pay_center {
        width: 80%;
        margin: 0 auto;
    }

    .paybtn {
        width: 100%;
        background-color: #00C800 !important;
        border-color: #00C800 !important;
    }

    .payImg {
        width: 230px;
        height: 230px;
        position: relative;
        text-align: center;
        margin: -3px auto 0px;
        padding: 10px;
        border: 1px solid #108EE9;
        background-color: #00AAEE;
    }

    .main_img {
        position: relative;
    }

    .copyBtn {
        text-align: center;
        font-size: 14px;
        background-color: #00AAEE;
    }

    .main_img .img_c {
        position: absolute;
        top: 45%;
        left: 50%;
        width: 42px;
        height: 42px;
        margin-left: -21px;
        margin-top: -10px;
    }

    #mytime {
        padding-bottom: 30px;
        font-size: 12px;
        color: #D0AA65;
    }

    .showgroup {
        margin: 45px 0;
    }

    .time {
        margin: 10px 0 0;
        color: #393636;
    }

    .count span {
        background-color: #00AAEE;
        color: #fff;
        border-radius: 5px;
        margin: 0 5px;
        padding: 0 10px;
        box-shadow: 1px 1px 1px #ccc;
    }

    .count span > p {
        margin: 5px 0;
    }

    @media (max-width: 768px) {
        .content {
            width: 98%;
        }
    }
</style>
</html>